<template>
  <el-dialog
    :visible.sync="visible"
    title="详情"
    top="30px"
    append-to-body
    :close-on-click-modal="false"
    :before-close="beforeClose"
  >
    <div v-loading="loading">
      <div class="dl-wrap">
        <div class="dl-dt">产品名</div>
        <div class="dl-dd">{{ goodsData.load_name }}</div>
      </div>

      <div class="dl-wrap">
        <div class="dl-dt">担保费率</div>
        <div class="dl-dd">{{ goodsData.gua_rate }} ‰</div>
      </div>

      <div class="dl-wrap">
        <div class="dl-dt">有效期</div>
        <div class="dl-dd">{{ goodsData.expire_days }} 个月</div>
      </div>

      <div class="dl-wrap">
        <div class="dl-dt">出函时间</div>
        <div class="dl-dd">{{ goodsData.open_hour }} 小时</div>
      </div>

      <div class="dl-wrap">
        <div class="dl-dt">最低收取保费</div>
        <div class="dl-dd">{{ goodsData.min_gua_fee }} 元</div>
      </div>

      <div class="dl-wrap">
        <div class="dl-dt">备注</div>
        <div class="dl-dd">{{ goodsData.remark }}</div>
      </div>
    </div>
  </el-dialog>
</template>

<script>
// import {  enumRiskMethod } from '@/credit/plugins/enum'
// import { enumLoadProduct } from '@/credit/plugins/enum'
export default {
  components: {},
  props: {
    visible: Boolean,
    goodsId: String,
  },
  data() {
    return {
      tableName: 'industrial_package',
      loading: false,
      goodsData: {},
    }
  },
  computed: {
    // goodsId() {
    //   return this.goodsData.industrial_package_id
    // },
  },
  watch: {
    visible: {
      handler: function () {
        if (this.visible) {
          this.getData()
        }
      },
      immediate: true,
    },
  },
  created() {},
  mounted() {},
  methods: {
    getData() {
      if (!this.goodsId) {
        this.goodsData = {}
        return
      }
      this.loading = true
      this.$api
        .getDataFromId(this.$serviceName, this.tableName, this.goodsId)
        .then(res => {
          this.goodsData = res?.data ?? {}
        })
        .finally(() => {
          this.loading = false
        })
    },
    beforeClose() {
      this.$emit('update:visible', false)
    },
  },
}
</script>

<style lang="scss" scoped></style>
